<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 26383
  Date: 2020/12/25
  Time: 23:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="layui-body">
    <div style="padding: 15px;position: absolute;left: 30%">
        <div class="layui-card" style="width: 400px;height: 550px;">
            <div class="layui-card-header" style="background-color: #FF5722">编辑</div>
            <div style="margin: 5px">
                <form method="post" action="/UpdateNewsInfo" class="layui-form" enctype="multipart/form-data" >
                    <div class="layui-form-item">
                        <input style="display: none" name="id" value="${sessionScope.news.id}">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-inline">
                            <input type="text" name="title" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="${sessionScope.news.title}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">作者</label>
                        <div class="layui-input-inline">
                            <input type="text" name="author" required lay-verify="required"
                                   autocomplete="off" class="layui-input" value="${sessionScope.news.author}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">时间</label>
                        <div class="layui-input-inline">
                            <input type="date" class="layui-input" name="n_datetime"  value="${sessionScope.news.datetime}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">类别</label>
                        <div class="layui-input-inline">
                            <select name="category" lay-verify="required">
                                <option value="${sessionScope.news.category}">${sessionScope.news.category}</option>
                                <c:forEach var="cate" items="${sessionScope.categories}">
                                    <option value="${cate.category}">${cate.category}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">添加者</label>
                        <div class="layui-input-inline">
                            <input type="text" name="addername" value="${sessionScope.news.adder}"
                                   lay-verify="required"
                                   placeholder="请输入添加者账号！" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片</label>
                        <div class="layui-input-inline">
                            <input type="file" name="picpath" lay-verify="required" autocomplete="off"
                                   class="layui-btn-sm">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">内容</label>
                        <div class="layui-input-inline">
                            <input type="text" name="main" required lay-verify="required"
                                   autocomplete="off" class="layui-textarea" value="${sessionScope.news.main}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" type="submit">修改</button>
                            <button class="layui-btn" type="reset">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

